<template>
  <div>
    <el-table v-loading="loading" :data="tableData" border style="width: 100%">
      <el-table-column prop="userName" label="用户名" width="230">
      </el-table-column>
      <el-table-column prop="userNum" label="用户账号" width="230">
      </el-table-column>
      <el-table-column
        prop="fbContent"
        label="用户反馈"
        width="650"
        show-overflow-tooltip
      >
      </el-table-column>
      <el-table-column label="操作" width="120" fixed="right">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row)" type="text" size="small"
            >查看</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <div class="admin-fenye">
      <el-pagination
        background
        layout="prev, pager, next"
        :total="total"
        :page-size="6"
        :currentPage="curPage"
        @current-change="page"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { request } from "../../network/request";

export default {
  name: "AdminMessage",
  data() {
    return {
      tableData: "",
      input: "",
      curPage: 1,
      total: 0,
      loading: true,
    };
  },
  created() {
    this.getMessage();
  },
  methods: {
    getMessage() {
      if (this.$route.query.page != undefined) {
        this.curPage = this.$route.query.page;
      }
      request({
        url: "/user/queryFeedback",
        method: "post",
        params: {
          pageNum: this.curPage,
        },
      })
        .then((res) => {
          this.tableData = res.data.data.list;
          this.total = res.data.data.total;
          this.loading = false;
        })
        .catch((err) => {
          console.log(err);
        });
    },
    handleClick(row) {
      this.$alert(row.fbContent, "用户反馈", {
        confirmButtonText: "确定",
      });
    },
    page(currentPage) {
      this.curPage = currentPage;
      this.loading = true;
      this.$router.push({
        path: "administrationmessage",
        query: {
          page: currentPage,
        },
      });
      this.getMessage();
    },
  },
};
</script>

<style>
</style>